Skip to content

Add conditional logic to nodes#14

Merged
fx merged 14 commits intomainfrom
mr/conditionals
Aug 14, 2025
Merged

Add conditional logic to nodes#14
fx merged 14 commits intomainfrom
mr/conditionals

Conversation

@fx
Copy link
Copy Markdown
Owner

@fx fx commented Sep 24, 2024

Summary

  • Brings back icon, add the standard Action Usable trigger via action_usable!
  • Adds conditional logic support for nested conditions (e.g., glow when aura stacks >= 2)
  • Supports operator parsing for conditions (>=, ==, <, etc.)

Features

  • icon method to create icon nodes with conditional triggers
  • action_usable! method with block support for nested conditions
  • aura method for buff/debuff conditional contexts
  • stacks, charges methods with glow! support
  • ✅ Operator parsing for flexible conditionals (e.g., spell_count: '>= 2')

Example Usage

icon 'Blade of Justice' do
  action_usable
  action_usable spell_count: '>= 2' do
    glow!
  end
end

icon 'Ray of Frost' do
  action_usable! do
    aura 'Cryopathy' do
      stacks '>= 2' do
        glow!
      end
    end
  end
end

Changes

  • Added aura method to Node for creating conditional trigger contexts
  • Updated glow! method to support operator parsing
  • Modified trigger classes to forward glow! calls to parent nodes
  • Cleaned up commented code in examples
  • Rebased on latest main

@vercel
Copy link
Copy Markdown

vercel bot commented Sep 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
weakauras Ready Preview Comment Aug 14, 2025 6:00am

fx added 7 commits August 14, 2025 05:17
- Add aura method for conditional trigger contexts
- Update glow! to support operator parsing (>=, ==, etc)
- Enable nested conditionals via stacks/charges with blocks
- Pass parent node context to triggers for glow! forwarding
- Clean up commented code in examples
@fx fx force-pushed the mr/conditionals branch from c96c872 to b132040 Compare August 14, 2025 05:21
@fx fx marked this pull request as ready for review August 14, 2025 05:23
Copilot AI review requested due to automatic review settings August 14, 2025 05:23
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.78%. Comparing base (7c96695) to head (18256a6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #14      +/-   ##
==========================================
- Coverage   62.29%   56.78%   -5.52%     
==========================================
  Files          15       35      +20     
  Lines         244      678     +434     
  Branches        0       29      +29     
==========================================
+ Hits          152      385     +233     
- Misses         92      281     +189     
- Partials        0       12      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive conditional logic support to WeakAura nodes, bringing back icon creation functionality and introducing nested condition handling. The changes enable more sophisticated WeakAura configurations with operator parsing and conditional triggers.

Key changes:

  • Restores icon method and adds action_usable! for creating conditional action triggers
  • Implements operator parsing for conditions (>=, ==, <, etc.) with support for spell counts, charges, and stacks
  • Adds aura method for buff/debuff conditional contexts with nested condition blocks

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
public/node.rb Core conditional logic implementation with operator parsing and aura context support
public/weak_aura/icon.rb Icon node creation with action_usable! method and conditional trigger support
public/weak_aura/triggers.rb Base trigger functionality with charges/stacks methods and glow! forwarding
public/weak_aura/triggers/action_usable.rb ActionUsable trigger with charges support and operator parsing
public/examples/* Updated example configurations demonstrating new conditional syntax
.devcontainer/* Development environment configuration updates
*_spec.rb Test files for new functionality
Comments suppressed due to low confidence (2)

fx added 2 commits August 14, 2025 05:27
- Remove trailing whitespace
- Fix comment grammar to present tense
- Add tests for parse_operator method
- Add tests for aura method and parent_node context
- Add tests for glow! with charges condition
- Add tests for charges/stacks methods with blocks
- Add tests for trigger glow! forwarding to parent
- Add tests for action_usable! block execution
- Use string keys consistently in glow! condition hash
- Initialize @parent_node in Trigger::Base constructor
- Remove duplicate parent_node assignments in methods
- Update Node#glow! to accept **options instead of options hash
- Update Trigger::Base#glow! to forward keyword arguments properly
- Fixes RSpec test failure expecting keyword arguments
- Test initialization with spell and spell_name options
- Test exact option behavior
- Test full trigger JSON structure generation
- Test charges option with operators
- Test omission of optional fields
- Test combination of spell_count and charges
- Increase coverage from 40% to near 100%
- Add tests for remaining_time method in Trigger::Base
- Add test for all_triggers! method in Icon
- Add test for hide_ooc! method in Node
- Cover all 4 remaining missing lines
- Achieve 100% patch coverage
@fx fx merged commit 73c8565 into main Aug 14, 2025
5 of 6 checks passed
@fx fx deleted the mr/conditionals branch August 14, 2025 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants